(function() {
  var transferData;

  transferData = {};

  this.gotaobao = function() {
    var ajaxSetting;
    saveUserData();
    delCook();
    closeOthers();
    ajaxSetting = {
      dataType: 'json',
      data: $('form').serialize(),
      error: gotaobao,
      success: function(data) {
        var config, notification;
        if (data && data.proxy) {
          config = {
            mode: "fixed_servers",
            rules: {
              proxyForHttp: data.proxy,
              bypassList: cdn
            }
          };
          chrome.proxy.settings.set({
            value: config,
            scope: 'regular'
          });
          transferData['searchData'] = {
            'keywords': data.keyword,
            'sellername': data.sellername
          };
          chrome.tabs.create({
            url: 'http://www.taobao.com',
            active: false
          });
          messenger.setSearchData(transferData);
          messenger.init();
        } else {
          messenger.finish();
          noProxy();
        }
        if (data.msg) {
          notification = webkitNotifications.createNotification(data.msg[0], data.msg[1], data.msg[2]);
          notification.show();
          setTimeout(function() {
            return notification.close();
          }, 30000);
        }
        if (data.errno) {
          messenger.finish();
          switch (data.errno) {
            case 1:
              return $('#pwLabel').show();
          }
        }
      }
    };
    $.ajax("" + serverUrlPre + "Visit/task", ajaxSetting);
    return false;
  };

}).call(this);
